package com.st.vmall.mapper;

import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.st.vmall.entity.Admin;

public interface AdminMapper {

	@Select( "select * from admin where username= #{username} and password = #{password}" )
	Admin selectByNameAndPwd(Admin admin);

	
	@Update("<script>update admin "
			+ "<set>"
			+ "<if test='username != null and username.length > 0'> username=#{username}, </if>"
			+ "<if test='password != null and password.length > 0'> password=#{password}, </if>"
			+ "<if test='photo != null and photo.length > 0'> photo=#{photo}, </if>"
			+ "<if test='phone != null and phone.length > 0'> phone=#{phone}, </if>"
			+ "<if test='name != null and name.length > 0'> name=#{name}, </if>"
			+ "<if test='status != null'> status=#{status}, </if>"
			+ "</set>"
			+ "where id = #{id}"
			+ "</script>")
	
	int update(Admin admin);

}
